﻿<%@ Page Language="C#" MasterPageFile="~/Layout.master" AutoEventWireup="true" CodeFile="ViewExpenses.aspx.cs"
    Inherits="Secured_ViewExpenses" Title="View Expenses" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolder1" runat="Server">
    <div style="font-size: large">
        View Expenses Occured
    </div>
    <br />
    <div>
        <asp:Literal ID="ltMsg" runat="server" />
    </div>
    <br />
    <div>
        <fieldset style="width: inherit; padding: 5px">
            <legend>Filter:</legend><span><strong>By Month:</strong>&nbsp;<asp:DropDownList ID="cmbMonths"
                runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbMonths_SelectedIndexChanged">
                <asp:ListItem Text="Jan" Value="Jan" />
                <asp:ListItem Text="Feb" Value="Feb" />
                <asp:ListItem Text="Mar" Value="Mar" />
                <asp:ListItem Text="Apr" Value="Apr" />
                <asp:ListItem Text="May" Value="May" />
                <asp:ListItem Text="Jun" Value="Jun" />
                <asp:ListItem Text="Jul" Value="Jul" />
                <asp:ListItem Text="Aug" Value="Aug" />
                <asp:ListItem Text="Sep" Value="Sep" />
                <asp:ListItem Text="Oct" Value="Oct" />
                <asp:ListItem Text="Nov" Value="Nov" />
                <asp:ListItem Text="Dec" Value="Dec" />
            </asp:DropDownList>
                &nbsp;<asp:DropDownList ID="cmbYear" runat="server" />
                &nbsp; <span><strong>By Expense Head:</strong></span>&nbsp;<asp:DropDownList ID="cmbExpenseHead"
                    runat="server" AutoPostBack="True" OnSelectedIndexChanged="cmbExpenseHead_SelectedIndexChanged" />
            </span>
            <div style="float: right">
                <asp:Button ID="btnReloadGrid" runat="server" Text="Refresh Report" />
            </div>
        </fieldset>
    </div>
    <br />
    <div>
        <asp:GridView ID="grdExpenses" runat="server" BackColor="White" BorderColor="#CC9966"
            BorderStyle="None" BorderWidth="1px" CellPadding="5"
            AutoGenerateColumns="False" OnRowCancelingEdit="grdExpenses_RowCancelingEdit"
            OnRowEditing="grdExpenses_RowEditing" OnRowUpdating="grdExpenses_RowUpdating"
            ShowFooter="false" DataKeyNames="ExpenseID,ExpenseDate,PaidBy,ForPeriod,ExpenseHead,ExpenseDesc,ExpenseAmount"
            OnRowDataBound="grdExpenses_RowDataBound" EnableModelValidation="True" 
            onrowdeleting="grdExpenses_RowDeleting">
            <RowStyle BackColor="White" ForeColor="#330099" />
            <FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
            <PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
            <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
            <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="#FFFFCC" HorizontalAlign="Left" VerticalAlign="Middle"/>
            <AlternatingRowStyle BackColor="#FFDD97" />
            <Columns>
                <asp:CommandField DeleteText="X" EditText="..." ShowDeleteButton="True" 
                    ShowEditButton="True" />
                <asp:BoundField DataField="ExpenseID" Visible="false" />
                <asp:TemplateField HeaderText="Expense On">
                    <ItemTemplate>
                        <%# Eval("ExpenseDate","{0:MMM dd, yyyy}") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditExpenseDate" runat="server" Text='<%# Eval("ExpenseDate","{0:MMM dd, yyyy}") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Paid By">
                    <ItemTemplate>
                        <%# DataBinder.Eval(Container.DataItem,"PaidBy") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="cmbEditPaidBy" runat="server" SelectedText='<%# Eval("PaidBy") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="For Month">
                    <ItemTemplate>
                        <%# Eval("ForPeriod") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditForPeriod" runat="server" Text='<%# Eval("ForPeriod") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Under Head">
                    <ItemTemplate>
                        <%# Eval("ExpenseHead") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:DropDownList ID="cmbEditExpenseHead" runat="server" SelectedText='<%# Eval("ExpenseHead") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Notes">
                    <ItemTemplate>
                        <%# Eval("ExpenseDesc") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditExpenseDesc" runat="server" TextMode="MultiLine" Rows="5"
                            Columns="30" Text='<%# Eval("ExpenseDesc") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Amount">
                    <ItemTemplate>
                        <%# DataBinder.Eval(Container.DataItem,"ExpenseAmount") %>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <asp:TextBox ID="txtEditExpenseAmount" runat="server" Text='<%# Eval("ExpenseAmount") %>' />
                    </EditItemTemplate>
                </asp:TemplateField>
            </Columns>
            <EmptyDataTemplate>
                No Data to Fetch!
            </EmptyDataTemplate>
        </asp:GridView>
        <br />
        <asp:LinkButton ID="lnkExport" runat="server" CommandName="Export" Text="Export to XLS"
            OnCommand="lnkExport_Command" />
        <br />
    </div>
    <br />
    <div style="font-size: large">
        Total Expenses:<asp:TextBox ID="txtTotal" runat="server" ReadOnly="true" Font-Bold="true" />
    </div>
</asp:Content>
